<template>
<div class="max">
        <div class="shaixuan">
      <span class="el-icon-zoom-in chaxun">筛选查询</span>
      <el-button class="btn-one">本月</el-button>
      <el-button class="btn-one">最近30天</el-button>
      <el-button class="btn-one">最近7日</el-button>
      <el-button class="btn-one" @click="onSubmit">本日</el-button>
      </div>
      <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      prop="id"
      label="序号"
      width="180">
    </el-table-column>
    <el-table-column
      prop="name"
      label="商品名称"
      width="180">
    </el-table-column>
    <el-table-column
      prop="salesAmount"
      label="销售额"
      width="180">
    </el-table-column>
    <el-table-column
      prop="saleCount"
      label="配送额">
    </el-table-column>
    <el-table-column
      prop="time"
      label="时间">
    </el-table-column>
  </el-table>
    <div class="block">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="5"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</div>
</template>

<script>
import { SpApi,SxxApi } from "@/http/userApi/XsApi/HqApi"

  export default {
    data() {
      return {
        tableData: [],
        total: 0,
        page: 1,
        size: 10,
        currentPage4: 5,
        formInline: {
          user: '',
          region: ''
        }
      }
    },
    created() {
    this.init(this.page,this.size);
    },
    methods: {
      init(page,size) {
      SpApi(page,size).then((res) => {
        console.log(res);
        this.tableData = res.data.data

      })
        .catch(err => {
          console.log(err);
        })
    },
    onSubmit() {
    // let time=new Date().toLocaleDateString().split("/")[1]?

      SxxApi(new Date())
        .then(res => {
          console.log(res,new Date().toLocaleDateString())
          this.tableData = res.data.data
        })
        .catch(e => {
          console.log(e)
        })
    },
      handleEdit(index, row) {
        console.log(index, row);
        alert('123');
      },
      handleDelete(index, row) {
        console.log(index, row);
        this.splice(index, 1);
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      }
    },
  }
  
</script>

<style lang="scss" scoped>
.max-hard {
  width: 100%;
  height: 50px;
  background-color: rgba(243, 243, 243);
  line-height: 50px;
  h4 {
    // padding-left: 80px;
    float: left;
    color: #666;
  }
  .btn {
    float: right;
    margin-top: 5px;
    // margin-right: 100px;
  }
}
.shaixuan {
  // margin-right: 100px;
  // margin-left: 80px;
  margin-top: 20px;
  height: 60px;
  line-height: 60px;
  background-color: rgba(243, 243, 243);
  border: 1px solid #999;
  span {
    display: inline-block;
  }
  .chaxun {
    margin-left: 20px;
  }
  .btn-one {
    float: right;
    height: 40px;
    margin-top: 10px;
    margin-right: 20px;
  }
  .btn-two {
    float: right;
    height: 40px;
    margin-top: 10px;
  }
}
.shaixuan1 {
  // margin-right: 100px;
  // margin-left: 80px;
  height: 60px;
  background-color: white;
  border: 1px solid #999;
  .demo-form-inline {
    padding-top: 10px;
    margin-left: 20px;
  }
}
.table-1 {
    // margin-left:80px;
    // margin-right:100px;
    margin-top: 20px;
    border: 1px solid #999;

}

.block {
    margin-left: 630px;
}
.shuaixuan-bt {
    // height: 60px;
    // margin-left: 80px;
    //  margin-right: 100px;
    // line-height: 60px;
    margin-top: 40px;
    background-color:#fff;
    border: 1px solid #999;
    .shai{
       margin-left: 20px;
       padding: 10px;
    }
  }
</style>
